#ifndef EMBEDEDDESIGNERFORM_H
#define EMBEDEDDESIGNERFORM_H

#include <QWidget>
#include <QAbstractButton>

namespace Ui {
    class Designer;
}

namespace qdesigner_internal {
    class QDesignerIntegration;
    class FormWindowBase;
}

class QDesignerFormWindowInterface;
class QDesignerFormEditorInterface;
class QAbstractTableModel;
class StatusBar;
class QDesignerWidgetBoxInterface;
class QDesignerObjectInspectorInterface;
class QDesignerPropertyEditorInterface;
class QDesignerActionEditorInterface;

namespace Plugins
{
    class Project;
    class Designer : public QWidget
    {
        Q_OBJECT
    public:
        explicit Designer(QWidget *parent = 0);
        virtual ~Designer();


        QWidget * widget();
        void setProject(Project *prj);
    public:

        bool loadFile(const QString & fileName);
        bool saveFile();
        bool isModified();
        void activate();
        void setStatusBar(StatusBar*);
    protected:
        void showEvent(QShowEvent *);
        void closeEvent(QCloseEvent *);
        void renderPyFile();
    signals:
        void fileChanged(bool);
        void copyAvailable(bool);
        void undoAvailable(bool);
        void redoAvailable(bool);
        void pasteAvailable(bool);
        void severityChanged(int sev);
        void errorListChanged(QAbstractTableModel*);
        void activated(QDesignerFormWindowInterface*);
    private slots:
        void onFormChanged();

        void onUndoAvailable();
        void onRedoAvailable();
        void onCopyAvailable();
        void onPasteAvailable();

        void onSwitchWidgets();
        void onSwitchTabOrder();
        void onSwitchBuddies();
    public slots:
        void undo();
        void redo();
        void copy();
        void cut();
        void paste();
        void del();
        void selectAll();
    private:
        Ui::Designer *ui;
        qdesigner_internal::QDesignerIntegration *_designer;
        QAction *_editTabAction;
        QAction *_editBuddies;
        QString _fileName;
        qdesigner_internal::FormWindowBase * _form;
        Project * _project;
        StatusBar * _bar;
        QObject * _menu;

        QDesignerWidgetBoxInterface *_wb;
        QDesignerObjectInspectorInterface *_oi;
        QDesignerPropertyEditorInterface * _pe;
        QDesignerActionEditorInterface *_ae;
    };

}

#endif // EMBEDEDDESIGNERFORM_H
